<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<script type="text/javascript">
function deleteCheck(no,currentPage){
	if(confirm(no + " 번 글을 삭제하시겠습니까?")){
		alert('삭제되었습니다.');
		location.href="EdeleteAction.action?no="+ no +"&currentPage="+ currentPage;
	}; 
}

function modifyCheck(no,currentPage){
	if(confirm(no + " 번 글을 수정하시겠습니까?")){
		location.href="EmodifyForm.action?no="+ no +"&currentPage="+ currentPage;
	}; 
}

function open_win_noresizable(url, name)
{
	var oWin = window.open(url, name, "scrollbars=no, status=no, resizable=no, width=300, height=150");
}

/* function get() {
	var url = "getsaram.action";
	open(
			url,
			"confirm",
			"toolbar=no, location=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=800, height=800");
} */
function meetchk(no,currentPage){
 var chk = ${meetchk};
 var memberp = ${memberpoint};
 var eventp = ${eventpoint};
 if(chk == -1){
	 alert("이미 신청한 이벤트입니다");
	 return false;
 }
 if(memberp < eventp){
	 if(confirm("포인트가 부족합니다 결제페이지로 가시겠습니까?")){
		 location.href="buyPointView.action";
	 }else{
		 return false;
	 }
 }else{
	 alert("신청되었습니다");
 location.href="EviewAction1.action?no="+ no +"&currentPage="+ currentPage;
 return true;
 }
}

function meetchk2(no,currentPage){
	 var chk = ${meetchk};
	 var memberp = ${memberpoint};
	 var eventp = ${eventpoint};
	 if(chk == -1){
		 alert("이미 신청한 이벤트입니다");
		 return false;
	 }
	 if(memberp < eventp){
		 if(confirm("포인트가 부족합니다 결제페이지로 가시겠습니까?")){
			 location.href="buyPointView.action";
		 }else{
			 return false;
		 }
	 }else{
		 alert("신청되었습니다");
	 location.href="EviewAction2.action?no="+ no +"&currentPage="+ currentPage;
	 return true;
	 }
	}

function deleteCheck2(no,currentPage,originno){
	if(confirm("작성하신 코멘트를 삭제하시겠습니까?")){
		alert('삭제되었습니다.');
		location.href="EdeleteAction2.action?no="+ no +"&currentPage="+ currentPage+"&originno="+originno;
	}
}
 

</script>
<h2 class="page_title"><strong>이벤트 게시판</strong></h2>
<div class="event_modul">
	
	<div class="image">
		<s:if test="resultClass.file_savname == null">
			<p class="align_c noImg">?</p>
		</s:if>
		<s:else>
			<img src="C:\\project_file\\eventboard\\<s:property value="resultClass.file_savname"/>" />
		</s:else>
	</div><!-- image -->
	<div class="text">
		<p class="align_r">
			<b>NO</b> : <s:property value="resultClass.no" /> <b>DATE</b> : <s:property value="resultClass.regdate" />
		</p>
		<p class="align_r">
			<b>VIEWS</b> : <s:property value="resultClass.readhit" />
		</p>
		<dl>
			<dt>EVENT NAME</dt>
			<dd><s:property value="resultClass.subject"/></dd>
			<dt>MACHMAKER</dt>
			<dd><s:property value="resultClass.nickname"/></dd>
			<dt>MAN COUNT</dt>
			<dd>now : <s:property value="resultClass.man_count"/> / max: <s:property value="resultClass.manmax" /></dd>
			<dt>LADY COUNT</dt>
			<dd>now : <s:property value="resultClass.lady_count"/> / max: <s:property value="resultClass.ladymax" /></dd>
			<dt>EVENTDATE</dt>
			<dd><s:property value="resultClass.eventdate" /></dd>
		</dl>
	</div><!-- text -->
	<div class="float_l content"><s:property value="resultClass.content" /></div>
	<div class="float_l meet_count">
		<s:if test="#session.session_gender=='남자'|| #session.session_isadmin== 1">
			<s:if test="resultClass.man_count >=resultClass.manmax">남자는 더이상 신청할수없습니다</s:if>
			<s:else>
		<%-- 	<a href="EviewAction1.action?no=<s:property value="no" />&currentPage=<s:property value="currentPage" />" onClick="meetchk()"> <b>MAN 신청하기</b></a> --%>
			<a href="#" onClick="javascript:meetchk('<s:property value="no"/>','<s:property value="currentPage" />');">MAN 신청하기</a>
			</s:else>
		</s:if>
		<s:if test="#session.session_gender== '여자' || #session.session_isadmin== 1">
			<s:if test="resultClass.lady_count >=resultClass.ladymax">여자는 더이상 신청할수없습니다</s:if>
				<s:else>
			    <%-- <a href="EviewAction2.action?no=<s:property value="no" />&currentPage=<s:property value="currentPage" />"> <b>LADY 신청하기</b></a> --%>
			    <a href="#" onClick="javascript:meetchk2('<s:property value="no"/>','<s:property value="currentPage" />');">LADY 신청하기</a>
			</s:else>
		</s:if>
					<!-- <p><input type="button" value="참가인원보기" onClick="get()" /></p> -->
	</div><!-- meet_count -->
</div><!-- event_modul -->


<p class="align_r">
<s:url id="modifyURL" action="modifyAction">
	<s:param name="no">
		<s:property value="no" />
	</s:param>
</s:url>
<s:url id="deleteURL" action="deleteAction">
	<s:param name="no">
		<s:property value="no" />
	</s:param>
</s:url>
<p class="align_r">
	<s:if test="#session.session_id == resultClass.id">
	<input type="button" value="수정" class="inputb" onClick="javascript:modifyCheck('<s:property value="no"/>','<s:property value="currentPage" />');">
	<input type="button" value="삭제" class="inputb" onClick="javascript:deleteCheck('<s:property value="no"/>','<s:property value="currentPage" />');">
	</s:if>
	
	<input name="list" type="button" value="목록" class="inputb" onClick="javascript:location.href='ElistAction.action?currentPage=<s:property value="currentPage" />'">
</p>

<h3><strong>COMMENT</strong></h3>
<table class="table_list">
	<colgroup>
		<col width="180px" />
		<col />
		<col />
		<col />
	</colgroup>
	<tr>
		<th>ID</th>
		<th>NICKNAME</th>
		<th>COMMENT</th>
		<th>DEL</th>
		<th>DATE</th>
	</tr>
	<s:iterator value="commentlist" status="stat">
	<tr>
		<td><s:property value="id" /></td>
		<td><s:property value="nickname" /></td>
		<td><s:property value="content" /></td>
		<td>
		<s:if test="#session.session_id == id">
		<a href="javascript:deleteCheck2('<s:property value="no"/>','<s:property value="currentPage" />','<s:property value="originno" />');"><font color="red"><strong>DEL</strong></font></a>
		</s:if>	
		</td>
		<td><s:property value="regdate" /></td>
	</tr>
	</s:iterator>
	<s:if test="commentlist.size() <= 0">
	<tr>
		<td colspan="5">
			작성된 코멘트가 없습니다. 
		</td>
	</tr>
	</s:if>	
</table>
<form action="EwriteCommentAction.action" method="post">
<fieldset>
<legend>덧글쓰기</legend>
	<s:hidden name="originno" value="%{resultClass.no}" />
	<s:hidden name="no" value="%{resultClass.no}" />
	<s:hidden name="currentPage" value="%{currentPage}" />
	<table>
		<tr>
			<td>
				<input type="text" name="id" value="${session.session_id}" maxlength="20" readonly="readonly" class="align_c"/>
				<input type="text" name="nickname" value="${session.session_nickname}" maxlength="20" readonly="readonly" class="align_c"/>
			</td>
			<td>
				<s:textarea name="content" theme="simple" value="" cols="60" rows="3" />
			</td>
			<td><input name="submit" type="submit" value="WRITE" /></td>
		</tr>
	</table>
</fieldset>
</form>

